#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
# @FileName  :config.py
# @Time      :2022/4/19 5:24 PM
# @Author    :Toliong toliong@foxmail.com
"""
# for loading environment variables: pip install python-dotenv
# for database :  pip install sqlalchemy  psycopg2

import os
from dotenv import load_dotenv
from pathlib import Path
from loguru import logger as lg

env_path = Path(".") / ".env"
load_dotenv(dotenv_path=env_path)


class Settings:
    PROJECT_NAME:str = "Job Board"
    PROJECT_VERSION: str = "1.0.0"
    # postgresql config
    POSTGRES_USER: str = os.getenv("POSTGRES_USER")
    POSTGRES_PASSWORD = os.getenv("POSTGRES_PASSWORD")
    POSTGRES_SERVER: str = os.getenv("POSTGRES_SERVER", "localhost")
    POSTGRES_PORT: str = os.getenv("POSTGRES_PORT", 5432)  # default postgres port is 5432
    POSTGRES_DB: str = os.getenv("POSTGRES_DB", "tdd")
    DATABASE_URL = f"postgresql://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_SERVER}:{POSTGRES_PORT}/{POSTGRES_DB}"
    # jwt
    ACCESS_TOKEN_EXPIRE_MINUTES = 30 # minutes
    SECRET_KEY: str = os.getenv("SECRET_KEY")
    ALGORITHM = "HS256"

    def show(self):
        return self.DATABASE_URL


settings = Settings()


if __name__ == "__main__":
    # print(settings.show())
    pass
